#ifndef SM4_UTILS_H
#define SM4_UTILS_H

#include <stdint.h>
#include <stddef.h>

#define SM4_KEY_SIZE 16
#define SM4_BLOCK_SIZE 16

// 生成随机SM4密钥
int sm4_generate_key(uint8_t key[SM4_KEY_SIZE]);

// SM4加密
int sm4_encrypt(const uint8_t *plaintext, size_t plaintext_len,
                const uint8_t key[SM4_KEY_SIZE],
                uint8_t *ciphertext, size_t *ciphertext_len);

// SM4解密
int sm4_decrypt(const uint8_t *ciphertext, size_t ciphertext_len,
                const uint8_t key[SM4_KEY_SIZE],
                uint8_t *plaintext, size_t *plaintext_len);

#endif // SM4_UTILS_H